package com.vstudy.zx.controller;

import com.vstudy.zx.entity.Teacher;
import com.vstudy.zx.service.CommentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping(value = "/comments")
public class CommentsController {
    @Autowired
    private CommentsService service;

    @RequestMapping(value = "/star", method = RequestMethod.POST)
    @ResponseBody
    public Object star(Integer star, Long article_id, HttpServletRequest request) {
        Teacher teacher = (Teacher) request.getSession().getAttribute("teacher");
        return service.star(teacher.getTe_id(), star, article_id);
    }
}
